// import 'pixi'
// import 'p2'
import Phaser from 'phaser-ce'
import BootState from './states/Boot'
import LoadingState from './states/Loading'
import PlayState from './states/Play'
import config from './config'

window.dpi = (num) => {
  return num * window.devicePixelRatio
}
class Game extends Phaser.Game {
  constructor () {
    const width = window.gameWidth
    const height = window.gameHeight

    const conf = {
      width: width * window.devicePixelRatio,
      height: height * window.devicePixelRatio,
      renderer: Phaser.CANVAS,
      transparent: false,
      // resolution: window.devicePixelRatio,
      antialias: true
      // resolution: window.devicePixelRatio
      // resolution: window.devicePixelRatio
      // zoom: 1 / window.devicePixelRatio // Set the zoom to the inverse of the devicePixelRatio

    }
    super(conf)

    this.state.add('Boot', BootState, true)
    this.state.add('Loading', LoadingState)
    this.state.add('Play', PlayState)

    this.state.start('Boot')
  }
}

window.game = new Game()
